﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;

namespace Dycox.Reporting
{
    [Serializable]
    public class ElementStyle : Style
    {
        public ElementStyle()
            : base(3)
        {

        }

        public ElementStyle(FontStyle fontStyle, BackgroundStyle background, BorderStyle border)
            : base(new Style[] { fontStyle, background, border })
        {
            
        }

        public Color ForeColor
        {
            get { return GetValueOrDefault<Color>("ForeColor"); }
            set { SetValue("ForeColor", value); }
        }

        public HorizontalAlignment HorizontalAlignment
        {
            get { return GetValueOrDefault<HorizontalAlignment>("HAlign"); }
            set { SetValue("HAlign", value); }
        }

        public VerticalAlignment VerticalAlignment
        {
            get { return GetValueOrDefault<VerticalAlignment>("VAlign"); }
            set { SetValue("VAlign", value); }
        }

        public FontStyle Font
        {
            get
            {
                return GetChild<FontStyle>(0, true);
            }
        }

        public BackgroundStyle Background
        {
            get
            {
                return GetChild<BackgroundStyle>(1, true);
            }
        }

        public BorderStyle Border
        {
            get
            {
                return GetChild<BorderStyle>(2, true);
            }
        }

        internal static ElementStyle CreateDefaultStyle()
        {
            ElementStyle style =
                new ElementStyle(new FontStyle(System.Drawing.SystemFonts.DefaultFont),
                    null,
                    new BorderStyle() { LineColor = Color.Black }
                    )
                    { ForeColor = Color.Black };

            return style;
        }
    }
}
